home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / dec92.zip / 1012014A < prev    next >
Text File  |  1992-10-06  |  317b  |  15 lines

  1. /* memchr function */
  2. #include <string.h>
  3.  
  4. void *(memchr)(const void *s, int c, size_t n)
  5.     {    /* find first occurrence of c in s[n] */
  6.     const unsigned char uc = c;
  7.     const unsigned char *su = (const unsigned char *)s;
  8.  
  9.     for (; 0  n; ++su, --n)
  10.         if (*su == uc)
  11.             return ((void *)su);
  12.     return (NULL);
  13.     }
  14.  
  15.